<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/11/1
  Time: 19:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link href="${pageContext.request.contextPath}/layui/css/layui.css" rel="stylesheet" />
    <script src="${pageContext.request.contextPath}/js/jquery-3.3.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/layui/layui.js"></script>
</head>
<body>
<ul class="layui-nav layui-bg-green" lay-filter="" style="height: 50px;margin-bottom: 10px;font-size: 40px">
    <li class="layui-nav-item" style="margin-left: 350px">
        全部商品分类
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd><a  href="${pageContext.request.contextPath}/goods/findPageByCid?cid=1&currentPage=1">IT技术</a></dd>
            <dd><a  href="${pageContext.request.contextPath}/goods/findPageByCid?cid=2&currentPage=1">小说文学</a></dd>
            <dd><a  href="${pageContext.request.contextPath}/goods/findPageByCid?cid=3&currentPage=1">历史传记</a></dd>
            <dd><a  href="${pageContext.request.contextPath}/goods/findPageByCid?cid=4&currentPage=1">生活</a></dd>
            <dd><a  href="${pageContext.request.contextPath}/goods/findPageByCid?cid=5&currentPage=1">经营管理</a></dd>
        </dl>
    </li>
    <li class="layui-nav-item layui-this">
        <input type="text" placeholder="输入关键字..." id="inputKeyword" style="height: 30px;width: 150px"/>
    </li>
    <li class="layui-nav-item">
        <button type="button" class="layui-btn layui-btn-radius layui-btn-warm" style="width: 100px;height: 30px;line-height: 30px"  onclick="search()" >商品搜索</button>
    </li>
    <li class="layui-nav-item">
      热门搜索:Java
    </li>
</ul>
</body>
<script>
    $(function () {
        //注意：导航 依赖 element 模块，否则无法进行功能性操作
        layui.use('element', function(){
            var element = layui.element;
            //…
        });
    })

    //获取输入框参数，传递到search服务
    function search() {
       let inputKeyword = $("#inputKeyword").val();
       // alert(inputKeyword);
       location.href="${pageContext.request.contextPath}/goods/search?keyword="+inputKeyword+"&currentPage=1";
    }
</script>
</html>
